package beans

import "fmt"

type Page struct {
	Page  int `gorm:"-" json:"page"`  // 页数
	Limit int `gorm:"-" json:"limit"` // 每页条数
}

func (page *Page) SetPage() {

	fmt.Printf("=====> page is : %d, limit is : %d \n", page.Page, page.Limit)

	if page.Page < 1 {
		page.Page = 0
	} else {
		page.Page = (page.Page - 1) * page.Limit
	}

	if page.Limit == 0 {
		page.Limit = -1 // 查询所有
	}
}
